package com.spider.demo1create;

public class ThreadDemo1 {
    public static void main(String[] args) {
        //目标：认识多线程，掌握创建线程的方式一：继承Thread类

        Thread t1 = new MyThread();
        t1.start();//调用start方法启动线程
        for (int i = 0; i < 5; i++) {
            System.out.println("主线程输出：" + i);
        }
    }
}
class MyThread extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println("子线程输出：" + i);
        }
    }
}
